//
// CFilterNetReceiver.h
//

#ifndef __H_CFilterNetReceiver__
#define __H_CFilterNetReceiver__

#include "CNetOutPin.h"
#include "CStreamSocket.h"
#include "CMsgStation.h"

class CFilterNetReceiver : public CBaseFilter, public CMsgStation
{
	friend class CNetOutPin;

private:
	CCritSec			mFilterLock;
	CNetOutPin *		mOutPin;

	BOOL				mIsVideo;
	CStreamSocket		mReceiver;
	IMediaSample *		mSample;

	// Used to set time stamp on audio sample
	long				mAudioBytesPerSecond;
	REFERENCE_TIME		mLastSampleTime;

public:
	CFilterNetReceiver(LPUNKNOWN punk, HRESULT *phr);
	~CFilterNetReceiver();

public:
	virtual int GetPinCount();
	virtual CBasePin * GetPin(int n);
	STDMETHODIMP Stop();

	void SetAudioBytesPerSecond(long inBytes);
	BOOL GetSampleBuffer(PBYTE * outBuffer);
	BOOL DeliverHoldingSample(long inSampleSize);

	// --- public methods ---
	void SetupMediaType(long inType, char * inFormat, long inLength);
	void SetStreamSocket(SOCKET inSocket);
	void StartReceiving(void);
};

#endif // __H_CFilterNetReceiver__